/**
 * Created by lllllxt on 2017-05-31.
 *
 * 解决angular动态生成的html片段回直接输出以及事件（ngClick、ngBlur等）不生效问题
 *
 * example: <div compile content="{{record.response}}"></div>
 */

define(['app'], function (app) {
    function directive($compile) {
        return {
            restrict: 'A',
            link: function (scope, element, attr) {
                element.html($compile(attr.content)(scope));
            }
        }
    }
    directive.$inject = ['$compile'];
    app.lazy.directive('compile', directive);
});

// angular.module('compileNg', []).directive('compile',['$compile',function($compile){
//     return {
//         restrict: 'A',
//         link: function (scope, element, attr) {
//             element.html($compile(attr.content)(scope));
//         }
//     }
// }]);